package cn.qayy.po;

import java.io.Serializable;
import java.util.Date;

import cn.qayy.dto.BidDTO;
import cn.qayy.utils.ArithUtil;
import cn.qayy.utils.DateUtils;

/**
 * 
 * 
 * @author wangyu
 * 中标库实体
 * @date 2018-05-31
 */
@SuppressWarnings("serial")
public class Bid implements Serializable{
	private Integer id;
    /**省份*/
    private String province="";
    /**地市*/
    private String city="";
    /**品种*/
    private String product="";
    /**包装*/
    private String pack="";
    /**中标价*/
    private String zbj="0";
    /**入货乙方*/
    private String terminal="";
    /**中标开始时间*/
    private String stime="";
    /**中标结束时间*/
    private String etime="";
    /**更新时间**/
    private Date mtime = new Date();
    
    /**
	 * 通过DTO初始化
	 * @param dto
	 * @return
	 */
	public Bid setByDTO(BidDTO dto) {
		this.setProvince(dto.getProvince());
		this.setCity(dto.getCity());
		this.setProduct(dto.getProduct());
		this.setPack(dto.getPack());
		this.setZbj(ArithUtil.format2bit(dto.getZbj()));
		this.setTerminal(dto.getTerminal());
		this.setStime(DateUtils.parseDate(dto.getStime()));
		this.setEtime(DateUtils.parseDate(dto.getEtime()));
		return this;
	}
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getMtime() {
		return mtime;
	}
	public void setMtime(Date mtime) {
		this.mtime = mtime;
	}
	public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province == null ? null : province.trim();
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city == null ? null : city.trim();
    }

    public String getProduct() {
        return product;
    }

    public void setProduct(String product) {
        this.product = product == null ? null : product.trim();
    }

    public String getPack() {
        return pack;
    }

    public void setPack(String pack) {
        this.pack = pack == null ? null : pack.trim();
    }

    public String getZbj() {
        return zbj;
    }

    public void setZbj(String zbj) {
        this.zbj = zbj == null ? null : zbj.trim();
    }

    public String getTerminal() {
        return terminal;
    }

    public void setTerminal(String terminal) {
        this.terminal = terminal == null ? null : terminal.trim();
    }

    public String getStime() {
        return stime;
    }

    public void setStime(String stime) {
        this.stime = stime == null ? null : stime.trim();
    }

    public String getEtime() {
        return etime;
    }

    public void setEtime(String etime) {
        this.etime = etime == null ? null : etime.trim();
    }
    

	@Override
	public String toString() {
		return "Bid [id=" + id + ", province=" + province + ", city=" + city + ", product=" + product + ", pack=" + pack
				+ ", zbj=" + zbj + ", terminal=" + terminal + ", stime=" + stime + ", etime=" + etime + "]";
	}
	
}